Realising nondeterministic I/O in the Glasgow Haskell Compiler
نویسنده
چکیده
In this paper we demonstrate how to relate the semantics given by the nondeterministic call-by-need calculus FUNDIO [SS03] to Haskell. After introducing new correct program transformations for FUNDIO, we translate the core language used in the Glasgow Haskell Compiler into the FUNDIO language, where the IO construct of FUNDIO corresponds to direct-call IO-actions in Haskell. We sketch the investigations of [Sab03b] where a lot of program transformations performed by the compiler have been shown to be correct w.r.t. the FUNDIO semantics. This enabled us to achieve a FUNDIO-compatible Haskell-compiler, by turning off not yet investigated transformations and the small set of incompatible transformations. With this compiler, Haskell programs which use the extension unsafePerformIO in arbitrary contexts, can be compiled in a ’safe’ manner.
منابع مشابه
The Glasgow Haskell Compiler: a Technical Overview
We give an overview of the Glasgow Haskell compiler, focusing especially on way in which we have been able to exploit the rich theory of functional languages to give very practical improvements in the compiler. The compiler is portable, modular, generates good code, and is freely available.
متن کاملFormulating Haskell
The functional programming language Haskell is examined from the point of view of proving programs correct. Particular features explored include the data type deenition facilities, classes, the behaviour of patterns and guards and the monad approach to IO in the Glasgow Haskell compiler.
متن کاملStrictness Analysis and let-to-case Transformation using Template Haskell
Metaprogramming consists of writing programs that generate or manipulate other programs. Template Haskell is a very recent extension of Haskell, currently implemented in the Glasgow Haskell Compiler, giving support to metaprogramming at compile time. Our aim is to apply these facilities in order to statically analyse programs and transform them at compile time. In this paper we use Template Has...
متن کاملUsing Template Haskell for Abstract Interpretation
Metaprogramming consists of writing programs that generate or manipulate other programs. Template Haskell is a recent extension of Haskell, currently implemented in the Glasgow Haskell Compiler, giving support to metaprogramming at compile time. Our aim is to apply these facilities in order to statically analyse programs and transform them at compile time. In this paper we use Template Haskell ...
متن کاملBenchmarking Implementations of Lazy Functional Languages Ii { Two Years Later
Six implementations of diierent lazy functional languages are compared using a common benchmark of a dozen medium-sized programs. The experiments that were carried out two years ago have been repeated to chart progress in the development of these compilers. The results have been extended to include all three major Haskell compilers. Over the last two years, the Glasgow Haskell compiler has been...
متن کامل